package org.despair2D.ui 
{
	import flash.geom.Point;
	import org.despair2D.ui.core.IComponent;
	import org.despair2D.ui.puppet.NineScalePuppet;
	
	import org.despair2D.core.ns_despair
	use namespace ns_despair;

	
public class ToolTipState extends PersonaState
{
	
	public function ToolTipState() 
	{
		super();
		m_offsetX = m_offsetY = m_gapX = m_gapY = 4
	}
	
	
	
	final public function get userData() : Object
	{
		return m_comp.userData
	}
	
	
	final public function get groupTip() : FusionGroup
	{
		return m_groupTip
	}
	
	
	
	final public function setProperty( offsetX:uint = 4,
										offsetY:uint = 4,
										gapX:int = 4,
										gapY:int = 4) : void
	{
		m_offsetX    =  offsetX;
		m_offsetY    =  offsetY;
		
		m_gapX  =  gapX
		m_gapY  =  gapY
	}
	
	
	public function setBackground( bgColor:uint = 0xc3F3F3, 
									bgAlpha:Number = 0.9, 
									lineColor:uint = 0, 
									lineAlpha:Number = 1,
									thickness:Number = 1,
									ellipse:Number = 2 ) : void
	{
		//var RSP:RawShapePuppet
		//
		//RSP = m_persona.createRawShapePuppet(0);
		//RSP.cacheAsBitmap = true
		//RSP.graphics.beginFill(bgColor, bgAlpha)
		//RSP.graphics.lineStyle(lineColor, lineAlpha)
		//RSP.graphics.drawRoundRect(0, 0, m_groupTip.width + 2 * m_gapX, m_groupTip.height + 2 * m_gapY, ellipse, ellipse)
	}
	
	
	public function setScaleBackground( displayRef:Class ) : void
	{
		var NSP:NineScalePuppet
		
		NSP = m_persona.createNineScalePuppet(displayRef, m_groupTip.width + 2 * m_gapX, m_groupTip.height + 2 * m_gapY, 0)
	}
	
	
	
	override ns_despair function preEnter() : void
	{
		var P:Point
		super.preEnter()
		
		P            =  m_comp.globalPos;
		this.group.x  =  P.x;
		this.group.y  =  P.y;
		m_groupTip   =  new FusionGroup()
		m_persona.addFusion(m_groupTip)
	}
	
	
	ns_despair function adjustTip() : void
	{
		m_groupTip.x = m_gapX
		m_groupTip.y = m_gapY
	}
	
	
	override ns_despair function dispose() : void
	{
		super.dispose()
		m_comp = null
		m_groupTip = null
	}
	
	
	ns_despair var m_comp:IComponent
	
	ns_despair var m_groupTip:FusionGroup
	
	ns_despair var m_offsetX:int
	
	ns_despair var m_offsetY:int;
	
	ns_despair var m_gapX:int;
	
	ns_despair var m_gapY:int
}

}